/**
 * 用于加载首页中商品的所有信息
 * @param {Object} url
 */
function loadIndexData(url)
		{
			$.ajax({
				type : 'POST',
				url  :  url,
				data :  '',
				contentType : 'application/json',
				dataType : 'json',
				success : function(data)
				{
					var json = eval(data);
					var jdata = json[0];
					var htmlstr = '';
					for(var key in jdata)
					{
						htmlstr += '<div class="tt">' +key + '</div><div class=\"tc\">'
						var products = jdata[key];
						for(var i = 0 ; i <products.length; i++)
						{
							var url = products[i].description; // 商品详细信息链接
							var pic = products[i].imageUrl; // 商品图片地址
							var name = products[i].name; // 商品名称
							var productId = products[i].id; // 商品Id;
							htmlstr +='<div class=\"pro\" name= ' + productId +'><div class=\"proimg\">' +
							'<img src=\"' + pic + '\"></div><div class=\"proname\">' + name + '</div></div>';
						}
						htmlstr += '</div>';
					}
					
					$('#products').html(htmlstr);
				},
				error : function(xhr, op, exception) {
					alert('操作异常！');
				}
			});
		}

 // 鼠标移入事件
 $('.pro').live('mouseover',function(){
	 $(this).attr('style','cursor:pointer');
 });

   // 绑定查看商品的URL
 $('.pro').live('click',function(){
	 // 获取商品编号
	 var productId = $(this).attr('name');
	 
	 //$.post('product/selectProduct',{'id': productId});
	 window.location.href = 'product/selectProduct?id='+productId;
	 
 });
 
 function subNum()
 {
	 var buyNum = $('#buyvalue').val();
	 if(buyNum < 2)
	 {
		 $('#subNum').attr("disabled",true);
	 }else
	 {
		 var num = parseInt(buyNum) - 1;
		 $('#buyvalue').val(num);
		 $('#subNum').attr("disabled",false);
	 }
 }
 function addNum()
 {
	 var productNum = $('#productNum').text();
	 var buyNum = $('#buyvalue').val();
	 if(parseInt(buyNum) >= parseInt(productNum))
	 {
		 $('#addNum').attr("disabled",true);
	 }else
	 {
		 var num = parseInt(buyNum) + 1;
		 $('#buyvalue').val(num);
		 $('#addNum').attr("disabled",false);
	 }	 
 }
 